dofile(os.getenv('LUAR_HOME') .. '/util/File.lua')

function execute()
	if arg[2] == nil then
		print("Argument with Component/Template name is nil")
		return false;
	end
	local file = File{}
	local luarcode = file:exists( 'lib/components/'..arg[2]..'/main.luar' )
	if luarcode == false then
		luarcode = file:exists( 'lib/templates/'..arg[2]..'/main.luar' )
		if luarcode == false then
			luarcode = file:exists( os.getenv('LUAR_HOME')..'/lib/components/'..arg[2]..'/main.luar' );
			if luarcode == false then
				luarcode = file:exists( os.getenv('LUAR_HOME')..'/lib/templates/'..arg[2]..'/main.luar' );
				if luarcode == false then
					print("Component or Template don't found");
					return false;
				else
					luarcode = file:readFile(os.getenv('LUAR_HOME')..'/lib/templates/'..arg[2]..'/main.luar');
				end
			else
				luarcode=file:readFile(os.getenv('LUAR_HOME')..'/lib/components/'..arg[2]..'/main.luar');
			end
		else
			luarcode = file:readFile('lib/templates/'..arg[2]..'/main.luar');
		end
	else
		luarcode = file:readFile('lib/components/'..arg[2]..'/main.luar');
	end
	local i1, j1 = string.find( luarcode, '<%%!' );
	local i2, j2 = string.find(luarcode, '%%>');
	if j1==nil or i2 == nil then
		print("Component/Template "..arg[2].." don't have informations about attributes");
		return false;
	end
	local attributes = string.sub(luarcode, j1+1, i2-1);
	if attributes == nil then
		print("Component/Template "..arg[2].." don't have informations about attributes");
		return false;
	else
		print(attributes);
	end
	return true;
end
